import java.util.Arrays;

/**
 * Created with Intellij IDEA
 * Description
 * User:ASUS
 * Date:2024-05-12
 * Time:19:29
 */
public class Test {
    public static boolean func5(int[] arr){
        int count=0;
        for(int i=0;i<arr.length;i++){
            if(arr[i]%2!=0) {
                count++;
                if (count == 3) {
                    return true;
                }
            }else{
                    count=0;
                }
            }
            return false;
        }

    public static void main(String[] args) {
        int[] arr = {2,6,4,1};
        System.out.println(func5(arr));
    }
    public static int func4(int[] array){
        Arrays.sort(array);
        return array.length/2;
    }

    public static void main6(String[] args) {
        int[] array={1,2,2,2,1};
        System.out.println(func4(array));
    }
    public static int func2(int[] arr){
        int ret=0;
        for(int i=0;i<arr.length;i++){
            ret^=arr[i];
        }
        return ret;
    }

    public static void main4(String[] args) {
        int[] arr=new int[]{4,1,2,1,2};
        System.out.println(func2(arr));
    }
    public static int[] func1(int[] arr,int target) {
        int[] ret= new int[]{1,-1};
        for (int i = 0; i < arr.length; i++) {
            for (int j = i + 1; j < arr.length; j++) {
                if (arr[i] + arr[j] == target) {
                    ret[0] = i;
                    ret[1] = j;
                }
            }
        }
        return ret;
    }

    public static void main3(String[] args) {
        int[] nums = new int[]{2, 7, 11, 15};
        System.out.println(Arrays.toString(func1(nums,9)));
    }

    public static void main2(String[] args) {
        int[] arr={5,3,6,1};
        Arrays.sort(arr);
        System.out.println(Arrays.toString(arr));
    }
    public static int binarySearch(int[] array,int key){
        int left=0;
        int right=array.length-1;
        while(left<=right){
            int mid=(left+right)/2;
            if(array[mid]==key){
                return mid;
            }else if(array[mid]>key){
                right=mid-1;
            }else{
                left=mid+1;
            }
        }
        return -1;
    }

    public static void main1(String[] args) {
        int[] array={1,2,3,4,5,6};
        System.out.println(binarySearch(array,5));
    }
}
